import pandas as pd
from pyecharts import options as opts
from pyecharts .charts import Radar
from pyecharts.globals import ThemeType
df = pd.read_excel('服装销售数据.xlsx',index_col=0)

radar = Radar(
    init_opts=opts.InitOpts(
    width='600px',height='400px',
    theme=ThemeType.ROMANTIC, page_title='雷达图'))

radar.add(df.columns[0],[df['针织衫'].tolist()],color='purple',label_opts=opts.LabelOpts(is_show=False))
radar.add(df.columns[1],[df['卫衣'].tolist()],color='blue',label_opts=opts.LabelOpts(is_show=False))
radar.add(df.columns[2],[df['连衣裙'].tolist()],color='green',label_opts=opts.LabelOpts(is_show=False))
radar.add_schema(
    schema=[
        opts.RadarIndicatorItem(name='新世界店', max_=52000),
        opts.RadarIndicatorItem(name='万科店', max_=52000),
        opts.RadarIndicatorItem(name='南京路店', max_=52000),
        opts.RadarIndicatorItem(name='滨江道店', max_=52000),
        opts.RadarIndicatorItem(name='和平路店', max_=52000),
    ],
    shape='circle',
    center=['50%', '60%'],
    splitline_opt=opts.SplitLineOpts(is_show=True,
        linestyle_opts=opts.LineStyleOpts(color='grey')),
    textstyle_opts=opts.TextStyleOpts(color='black'),
)
radar.set_global_opts(
    title_opts=opts.TitleOpts(
        title='各类服装在不同门店的销售额雷达图',
         pos_left='center'),
    legend_opts=opts.LegendOpts(pos_right='5%', pos_top='10%')
)
radar.render('radar_sale.html')
